package action.custom;

import java.util.List;
import core.action.BaseAction;
import service.custom.CustomServiceDo;
import util.Sessions;

public class CustomActionList extends BaseAction{
	private CustomServiceDo customServiceDo;
	private List<?> getlist;
	private Integer cid;
	private String editflage;

	public String getEditflage() {
		return editflage;
	}

	public void setEditflage(String editflage) {
		System.out.println(editflage);
		Sessions.set("eflage", editflage);
		this.editflage = editflage;
	}

	public String execute() {
		return "success";
	}	
	
	public String externalguaranteelist(){
		setcid();
		getlist=customServiceDo.externalguaranteeList(cid);
		super.successResultValue="listExternalguarantee";
		return "success";
	}
	
	public String companylistshow(){
		setEditflage("show");
		getlist=customServiceDo.companyList();
		super.successResultValue="listCompany";
		return "success";
	}
	
	public String companylistmodify(){
		setEditflage("modify");
		getlist=customServiceDo.companyList();
		super.successResultValue="listCompany";
		return "success";
	}

	
	public String personallistshow(){
		setEditflage("show");
		getlist=customServiceDo.personalList();
		super.successResultValue="listPersonal";
		return "success";
	}
	
	public String personallistmodify(){
		setEditflage("modify");
		getlist=customServiceDo.personalList();
		super.successResultValue="listPersonal";
		return "success";
	}
	
	public String personallist(){
		getlist=customServiceDo.personalList();
		super.successResultValue="listPersonal";
		return "success";
	}
	
	
	public String otherloanlist(){
		setcid();
		getlist=customServiceDo.otherloanList(cid);
		super.successResultValue="listOtherloan";
		return "success";
	}
	
	public String contactlist(){
		setcid();
		getlist=customServiceDo.contactList(cid);
		super.successResultValue="listContact";
		return "success";
	}
	public String bankcreditlist(){
		setcid();
		getlist=customServiceDo.bankcreditList(cid);
		super.successResultValue="listBankcredit";
		return "success";
	}
	
	public String pledgercompanylist(){
		setcid();
		getlist=customServiceDo.pledgerList(cid,2);
		super.successResultValue="listPledgerCompany";
		return "success";
	}
	
	public String pledgerpersonallist(){
		setcid();
		getlist=customServiceDo.pledgerList(cid,1);
		super.successResultValue="listPledgerPersonal";
		return "success";
	}
	
	public String foreigninvestorlist(){
		setcid();
		getlist=customServiceDo.foreigninvestorList(cid);
		super.successResultValue="listForeigninvestor";
		return "success";
	}
	
	public String givingcreditlist(){
		setcid();
		getlist=customServiceDo.givingcreditList(cid);
		super.successResultValue="listGivingcredit";
		return "success";
	}
	
	public String managelist(){
		setcid();
		getlist=customServiceDo.manageList(cid);
		super.successResultValue="listManage";
		return "success";
	}
	
	public String  cashflowlist(){
		setcid();
		getlist = customServiceDo.cashflowList(cid);
		super.successResultValue="listCashflow";
		return "success";
	}
	
	public String  profitlist(){
		setcid();
		getlist = customServiceDo.profitList(cid);
		super.successResultValue="listProfit";
		return "success";
	}
	
	public String  assetsdebtlist(){
		setcid();
		getlist = customServiceDo.assetsdebtList(cid);
		super.successResultValue="listAssetsdebt";
		return "success";
	}
	
	public String guarantorlist(){
		setcid();
		getlist=customServiceDo.guarantorList(cid);
		super.successResultValue="listGuarantor";
		return "success";
	}
	
	public String investorlist(){
		setcid();
		getlist=customServiceDo.investorList(cid);
		super.successResultValue="listInvestor";
		return "success";
	}
	
	public String listinglist(){
		setcid();
		getlist=customServiceDo.listingList(cid);
		super.successResultValue="listListing";
		return "success";
	}
	
	public String prosecutedlist(){
		setcid();
		getlist=customServiceDo.prosecutedList(cid);
		super.successResultValue="listProsecuted";
		return "success";
	}
	
	public String topmanagerlist(){
		setcid();
		getlist=customServiceDo.topmanagerList(cid);
		super.successResultValue="listTopmanager";
		return "success";
	}
	
	private void setcid(){
		Object temp=Sessions.get("companyid");
		cid=temp==null?0:(Integer)temp;
		p("session: company: "+cid);
	}
	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	public CustomServiceDo getCustomServiceDo() {
		return customServiceDo;
	}

	public void setCustomServiceDo(CustomServiceDo customServiceDo) {
		this.customServiceDo = customServiceDo;
	}

	public List<?> getGetlist() {
		return getlist;
	}

	public void setGetlist(List<?> getlist) {
		this.getlist = getlist;
	}

	public Integer getCid() {
		return cid;
	}

	public void setCid(Integer cid) {
		this.cid = cid;
	}


}
